<?php 
/**************************************************/
## Class Name - Model_SEO (Contains all the functions related SEO modules)
## Created By - Techmodi (22/08/2011)
/**************************************************/
class Model_SEO extends Database
{	
	function Model_SEO() {	
		$this->Seos = SEO;
		$this->Database();
	}
	
	// for add SEO
	function addSeo($array) {
		$this->InsertData($this->seos, $array);
	}
	
	## List all seos
	function getAllSeos($search,$col1='',$limit='',$offset='') {
		$fields = array();	
		$tables = array($this->Seos);
		if(trim($search)) {
			$where[] = "module_name LIKE '%".$search."%'";
		}
		if($col1=='1')
			$order = array("LTRIM(module_name) DESC");
		if($col1=='0')
			$order = array("LTRIM(module_name) ASC");
			
		$result1 = $this->SelectData($fields,$tables, $where , $order, $group=array(),$limit,$offset,0); 
		$result  = $this->FetchAll($result1); 
		return $result;
	}
	
	## List all Seos
	function getAllSeosFront($search,$limit='',$offset='') {
		$fields = array();	
		$tables = array($this->Seos);
		if(trim($search)) {
			$where[] = "module_name LIKE '%".$search."%'";
		}
		else
		{
			$where[] = "";
		}
		$result1 = $this->SelectData($fields,$tables, $where , $order = array(), $group=array(),$limit,$offset,0); 
		$result  = $this->FetchAll($result1); 
		return $result;
	}
	
	## Get Seo details by id
	function getSeoDetailsById($id) {
		$fields = array();	
		$tables = array($this->Seos);
		$result1 = $this->SelectData($fields,$tables, $where= array("id=$id"), $order = array(), $group=array(),$limit = "",0,0); 
		$result  = $this->FetchRow($result1); 
		return $result;
	}
	
	## Edit Seo by id
	function editSeoById($array, $Id){
		$this->UpdateData($this->Seos,$array,"id",$Id,1);
	}
	
		
	## Delete Seo with multiple ids
	function deleteSeo($ids, $status) {
		$sql = "DELETE FROM ".$this->Seos." WHERE id IN (".$ids.")";
		$result1= $this->ExecuteQuery($sql);	 
	}
	
	## Delete Seo by id
	function deleteSeoById($id){
		$this->DeleteData($this->Seos,"id",$id);
	}
	

}
?>


